/*
 * arp.h
 *
 *  Created on: Jun 23, 2010
 *      Author: fify
 */

#ifndef ARP_H_
#define ARP_H_

#include "net/linux/if_ether.h"
#include "net/linux/if_arp.h"

struct TAPState;

struct arp_packet
{
	struct ethhdr m_eth;
	struct arphdr m_arp;

	unsigned char m_padding[18];
};

void build_arp_request(struct arp_packet *pkt,
		struct mac_addr *sender_mac, unsigned char sender_ip[],
		struct mac_addr *target_mac, unsigned char target_ip[]);

void build_arp_reply(struct arp_packet *pkt,
		struct mac_addr *sender_mac, unsigned char sender_ip[],
		struct mac_addr *target_mac, unsigned char target_ip[]);

// Replay all arp requests.
int reply_arp_v(struct TAPState *s, __const struct iovec *__iovec, int __count);

#endif /* ARP_H_ */
